import { defineStore } from "pinia";
import { getTypeNav } from "@/api/requestHome";
import { CategoryList } from "./storeType";

export default defineStore("xiaozhan", {
  actions: {
    //三级联动typeNav数据
    async getTypeNav() {
      try {
        const result = await getTypeNav();
        this.CategoryList = result.data;
        // localStorage.setItem("state", JSON.stringify(this.$state));
      } catch (error) {
        return Promise.reject(error);
      }
    },
  },
  state: () => {
    return {
      CategoryList: <CategoryList[]>[],
      // 面包屑数据 -- 产品详细数据 内存 屏幕大小 运行内存之类
      crumbData: {
        crumb: <string[]>[],
        trademark: <string>"",
      },
    };
  },
});
